﻿using System.Text;
using Abp.Application.Services;
using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using System.Linq;
using Abp.Linq.Extensions;
using Abp.Extensions;
using Sunlit.Business.Commerces.Dto;
using Abp.Domain.Repositories;

namespace Sunlit.Business.Commerces
{
    public class CommerceMessageAppService: AsyncCrudAppService<CommerceMessage, CommerceMessageDto,long,
        GetAllCommerceMessageInput,CreateCommerceMessageInput,UpdateCommerceMessageInput>,ICommerceMessageAppService
    {
        public CommerceMessageAppService(IRepository<CommerceMessage, long> repository):base(repository)
        {

        }
        protected override IQueryable<CommerceMessage> CreateFilteredQuery(GetAllCommerceMessageInput input)
        {
            return base.CreateFilteredQuery(input)
                .WhereIf(input.CommerceId.HasValue, m => m.CommerceId == input.CommerceId)
                .WhereIf(input.ReceiverId.HasValue, m => m.ReceiverId == input.ReceiverId);
        }
    }
}
